<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">
    <script src="../static/layui/layui.js"></script>
    <style>
        .layui-form-selectup dl {
            top: 42px;
            bottom: unset;
        }
    </style>
</head>
<body>


<!--表单-->
<form class="layui-form" action="" id="queryform">

    <div class="layui-inline">
        <label class="layui-form-label">关键字</label>
        <div class="layui-inline">
            <input type="text" name="keyword" placeholder="请输入名称或电话" autocomplete="off" class="layui-input">
        </div>
    </div>


<!--    <div class="layui-inline">-->
<!--        <label class="layui-form-label">跟进类型</label>-->
<!--        <div class="layui-inline">-->
<!--            <select name="type" lay-filter="type">-->
<!--                <option value="全部" selected>全部</option>-->
<!--                <option value="潜在客户">潜在开发</option>-->
<!--                <option value="正式客户">正式跟进</option>-->
<!--            </select>-->
<!--        </div>-->
<!--    </div>-->

    <div class="layui-inline">
        <button class="layui-btn" lay-submit lay-filter="query">查询</button>
    </div>
</form>


<!--table-->
<table class="layui-hide" id="cutable" lay-filter="cutable"></table>




<script type="text/javascript">

    layui.use(['table','form','jquery','layer'],function () {

        var table=layui.table;
        var form=layui.form;
        var $=layui.jquery;
        var layer=layui.layer;


        table.render({
            elem: '#cutable'
            , url: '/trans/list'
            , defaultToolbar:[]
            , title: '跟进历史表'
            , cols: [
                [
                    // {type:'checkbox'},
                    {type: 'numbers', title: '编号',align: 'center'}
                    ,{field: 'cu.name', title: '姓名', edit: 'text',align: 'center',templet:function (d) {
                        var res='';
                        if (d.cu!=null){
                            res=d.cu.name;
                        }
                        return res;
                    }}
                    ,{field: 'transTime', title: '操作日期', edit: 'text',align: 'center'}
                    ,{field: 'transUser.name', title: '操作人', edit: 'text',align: 'center',templet:function (d) {
                        var res='';
                        if (d.transUser!=null){
                            res=d.transUser.name;
                        }
                        return res;
                    }}
                    ,{field: 'oldSeller.name', title: '旧营销人员', edit: 'text',align: 'center',templet:function (d) {
                        var res='';
                        if (d.oldSeller!=null){
                            res=d.oldSeller.name;
                        }
                        return res;
                    }}
                    ,{field: 'newSeller', title: '新营销人员', edit: 'text',align: 'center',templet:function (d) {
                        var res='';
                        if (d.newSeller!=null){
                            res=d.newSeller.name;
                        }
                        return res;
                    }}
                    ,{field: 'transReason', title: '移交原因', edit: 'text',align: 'center'}


                ]
            ]
            ,request:{
                pageName: 'currentPage',
                limitName: 'PageSize'
            }
            ,parseData:function (res) {
                return{
                    "code":0,
                    "msg":res.msg,
                    "count":res.data.totalConut,
                    "data":res.data.data
                }
            }
            ,page:true

        });




        // 查询提交
        form.on('submit(query)',function (data) {
            // console.log(data.field);
            table.reload('cutable',{
                where:data.field,
                page:{
                    curr:1,
                }
            })
            return false;
        })

    })
</script>

</body>
</html>